﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Castle.ActiveRecord;
using Castle.ActiveRecord.Queries;
using NHibernate.Criterion;
using System.Collections;

/// <summary>
/// Summary description for Tour
/// </summary>
namespace LIB
{
    [ActiveRecord("Home")]
    public class Home_Info : ActiveRecordBase<Home_Info>
    {
        private int _id;
        private string _homeName;
        private string _homeAvatar;
        private double _homeGia;
        private double _homeArea;
        private string _homeComonInfo;
        private string _homePrivateInfo;
        private bool _homeIsShowPrivate;
        private string _homeDemoVideo;
        private string _homeDemoBanDo;
        private string _homeIntro;

        [PrimaryKey(PrimaryKeyType.Native)]
        public int id
        {
            get { return _id; }
            set { _id = value; }
        }
        [Property]
        public string homeIntro
        {
            get { return _homeIntro; }
            set { _homeIntro = value; }
        }
        [Property]
        public string homeName
        {
            get { return _homeName; }
            set { _homeName = value; }
        }
        [Property]
        public string homeAvatar
        {
            get { return _homeAvatar; }
            set { _homeAvatar = value; }
        }
        [Property]
        public double homeGia
        {
            get { return _homeGia; }
            set { _homeGia = value; }
        }
        [Property]
        public double homeArea
        {
            get { return _homeArea; }
            set { _homeArea = value; }
        }
        [Property]
        public string homeComonInfo
        {
            get { return _homeComonInfo; }
            set { _homeComonInfo = value; }
        }
        [Property]
        public string homePrivateInfo
        {
            get { return _homePrivateInfo; }
            set { _homePrivateInfo = value; }
        }
        [Property]
        public bool homeIsShowPrivate
        {
            get { return _homeIsShowPrivate; }
            set { _homeIsShowPrivate = value; }
        }
        [Property]
        public string homeDemoVideo
        {
            get { return _homeDemoVideo; }
            set { _homeDemoVideo = value; }
        }
        [Property]
        public string homeDemoBanDo
        {
            get { return _homeDemoBanDo; }
            set { _homeDemoBanDo = value; }
        }
        public static Home_Info[] searchHome(string lstCatID, int soCatID, string orderBy)
        {
            SimpleQuery q = new SimpleQuery(typeof(Home_Info), QueryLanguage.Sql, @"EXEC searchHome @lstCatID=?,@soCatID=?,@orderBy=?", new object[] { lstCatID, soCatID,orderBy });
            q.AddSqlReturnDefinition(typeof(Home_Info), "listDes");
            Home_Info[] des = (Home_Info[])ExecuteQuery(q);
            return des;
        }
        public static Home_Info[] searchHomeInQuanHuyen(int quanHuyenID, int mucGiaID, string lstCatID, int soCatID, string orderBy)
        {
            SimpleQuery q = new SimpleQuery(typeof(Home_Info), QueryLanguage.Sql, @"EXEC searchHomeInQuanHuyen @quanHuyenID=?,@mucGiaID=?,@lstCatID=?,@soCatID=?,@orderBy=?", new object[] { quanHuyenID, mucGiaID, lstCatID, soCatID, orderBy });
            q.AddSqlReturnDefinition(typeof(Home_Info), "listDes");
            Home_Info[] des = (Home_Info[])ExecuteQuery(q);
            return des;
        }


    }

     
}
